#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    //绑定线程信号
    connect(&thread, &TimeThread::thread_signal, this, &Widget::handlersignal);
    //启动线程
    thread.start();
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handlersignal()
{
    //获取倒计时的值
    int value = ui->lcdNumber->intValue();
    if(value <= 0)
    {
        return;
    }
    //更新
    ui->lcdNumber->display(value - 1);

}

